package cn.edu.scau.cmi.linhuanrui.composite.consistent;

import java.util.HashSet;
import java.util.Set;

public class ConsitentTeam extends ConsitentOrganization {
	Set<ConsitentOrganization> children = new HashSet<ConsitentOrganization>();

	public ConsitentTeam(String name) {
		super(name);
	}

	public void addChild(ConsitentOrganization child) {
		this.children.add(child);
	}

	public void deleteChild(ConsitentOrganization child) {
		this.children.remove(child);
	}

	public ConsitentOrganization getParent() {
		return this.parent;
	}

	public Set<ConsitentOrganization> getChildren() {
		return this.children;
	}

	public void show(int level) {
		if (level == 0) {
			System.out.println(name);
		} else {
			for (int i = 0; i < level; i++) {
				System.out.print("\t");
			}
			System.out.println(name);
		}
		for (ConsitentOrganization child : children) {
			child.show(level + 1);
		}
	}
}
